﻿using System.Collections.Generic;

namespace TimeTravel.XnaLibrary.GamePlay
{
	/// <summary>
	/// Class representing a race of different units.
	/// </summary>
	public class Race
	{
		private List<Unit> mUnits;

		/// <summary>
		/// Gets an array holding all the units this race possesses.
		/// </summary>
		public List<Unit> Units
		{
			get { return mUnits; }
		}

		/// <summary>
		/// Initializes a new Race instance,
		/// </summary>
		public Race()
		{
			mUnits = new List<Unit>();
		}

		/// <summary>
		/// Initializes a new Race instance by copying the specified race.
		/// </summary>
		/// <param name="race">The race to copy from.</param>
		public Race(Race race)
		{
			this.mUnits = new List<Unit>(race.mUnits.Capacity);
			for (int i = 0; i < race.mUnits.Count; i++)
			{
				this.mUnits.Add(new Unit(race.mUnits[i]));
			}
		}

		/// <summary>
		/// Returns a value indicating where the race can build the given unit.
		/// </summary>
		/// <param name="unitTier">The tier of the unit to check for.</param>
		public bool CanBuildUnit(int unitTier)
		{
			return mUnits[unitTier].Level > 0;
		}
	}
}
